import React, { PureComponent, Suspense } from 'react';
import { connect } from 'dva';
import { Card, Col, message, Radio, Row, Select } from 'antd';

import Donut from '@/pages/PositionSystem/PositionStatistics/Donut';
import PageHeaderWrapper from '@/components/PageHeaderWrapper';

@connect(({ cpb, loading }) => ({
  cpb,
  loading: loading.models.cpbRule,
}))
class Position extends PureComponent {
  state = {
    // param: {
    //   fund: "0"
    // },
    // param1: {
    //   fund: "1"
    // },
  };

  data = [
    {
      item: '事例一',
      count: 40,
    },
    {
      item: '事例二',
      count: 21,
    },
    {
      item: '事例三',
      count: 17,
    },
    {
      item: '事例四',
      count: 13,
    },
    {
      item: '事例五',
      count: 5,
    },
  ];

  donutClick(value) {
    alert(value);
  }

  render() {
    const {
      cpb: { fundPieData },
    } = this.props;
    return (
      <PageHeaderWrapper title="花旗持仓占比">
        <Card bordered={false}>
          <div>
            <Row>
              <Col xl={24} lg={24} md={24} sm={24} xs={24} offset={1}>
                <Col span={24}>
                  {fundPieData.list.items.length === 0 ? (
                    <div />
                  ) : (
                    <div>
                      {
                        <Donut
                          data={fundPieData.list.items}
                          title={fundPieData.list.title}
                          date={fundPieData.list.date}
                        />
                      }
                    </div>
                  )}
                </Col>
              </Col>
            </Row>
          </div>
        </Card>
      </PageHeaderWrapper>
    );
  }

  // 加载完 之后 再加载 此 方法
  componentDidMount() {
    const { dispatch } = this.props;
    // const {param,param1} = this.state;
    dispatch({
      type: 'cpb/GetCpbSumIndustry',
      payload: {},
    });
  }
}

export default Position;
